<template>
    <Card>
        <Collapse v-model="openPanel">
            <Panel name="0">
                合同信息
                <div class="content" slot="content">
                    <trailContract
                        :applyNo = "applyNo"
                        @backInfo = "trailContractbackInfo"
                    />
                </div>
            </Panel>
            <Panel name="1">
               试算信息
                <div class="content" slot="content">
                    <trailCalculate
                        :op = "op"
                        :isSP = "isSP"
                        :isTrail = "isTrail"
                        :applyNo = "applyNo"
                        :contractNo = "contractNo"
                        :isSixPeriod = "isSixPeriod"
                        :quotationId = "quotationId"
                        :contractForm = "contractForm"
                        :isApprove="isApprove"
                        :auditOp = "auditOp"
                        @backInfo = "trailCalculatebackInfo"
                        @next = "close"
                    />
                </div>
            </Panel>
        </Collapse>
    </Card>
</template>

<script>

    //合同信息
    import trailContract from "_p/basic/pages/contract/common/trial-info/trail-contract.vue";
    //试算信息
    import trailCalculate from "_p/basic/pages/contract/common/trial-info/trail-calculate.vue";

    export default {
        components: {
            trailContract,
            trailCalculate,
        },
        name: "trailSettle",
        props: {
            //状态
            op:{
                type:String,
                required: true,
                default: 'view'
            },
            //是否试算
            isTrail:{
                type: Boolean,
                required: true,
                default: true
            },
            //是否SP
            isSP: {
                type: Boolean,
                required: true,
                default: true
            },
            //申请编号
            applyNo:{
                type:String,
            },
            //试算ID
            quotationId:{
                type:String,
            },
            //合同编号
            contractNo:{
                type:String,
            },
        },
        data() {
            return {
                openPanel: [0, 1],
                contractForm:{},//试算清单信息
                isSixPeriod:false, //是否满六期
                trailForm:{},//试算结果信息
                //审核状态【add,edit,view】
                auditOp: "view",
                //是否是审批页面
                isApprove: false,
            }
        },
        computed: {

        },
        methods: {
            init() {

            },
            //请求结果
            trailContractbackInfo(param){
                this.contractForm = param;
                if(param.alreadyPeriods<6){
                    this.isSixPeriod = true;
                }
            },
            //试算结果
            trailCalculatebackInfo(param){
                this.trailForm = param;
            },
            close(){
                this.$emit('back', "退回");
            },
        },
        mounted() {
            this.init();
        },
        created() {
        },
    }
</script>

<style scoped>

</style>
